Second attempt to fix #11453

This needs review from @thatch45.