Thanks KyleMac for the report, regebro for the patch, and Aymeric for the test. Backport of 71b5617c from master.