Fixes https://github.com/bitcoin/bitcoin/issues/4630