Thanks Sjoerd Job Postmus for the report and initial patch. Thanks Michael Manfre, Tim Graham, and Florian Apolloner for review. Backport of 402c0caa85 from master
402c0caa85
Backport of 5cc6f02f91 from master
5cc6f02f91