Merged changed from pull request #167