manually applied pull request #212