Thanks to Tim for the review.
Thanks jukvalim for the report and initial patch, and Preston Timmons for review.