manually merged changes from pull request 209