incorporated the changes from pull request #243. closes #243