revert Martin's patch, merge with upstream