Changes from pull request #524