partially revert to a75dad35dd99e05f23a91d88e99127d4e903c35b, fixes #1263