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