Fix for #443.

Thanks to @DominikTo and @armin-hackmann for doing the research and
coming up with a solution. Sorry for taking so long.