Thanks Peter Schmidt for the report and the initial patch. Thanks to Oktay Sancak for writing the original failing test and Alvin Savoy for supporting contributing back to the community. Backport of d7bc37d61 from master.
Thanks codeitloadit for the report, living180 for investigations and Tim Graham for the review. Backport of 27dd7e7271 from master.
Backport of 439f15beabe2e4d21232798f805ba69367611276 from master