added fix from pull request #64 manually to branch