Re-apply bugfix fff0976ef744d6b18ac8abaa9b7552a1985ccac1 that was accidentally set back by cfd6c8c54f100aa5159b70b8bd19a97bc6553876