Thanks Simon Charette and Tim Graham for the review and Carlos E. C. Leite for the report. Backport of fc48047586a8f92262f55d9d2bfb976325844b23 from master