Fix for issue #317.
Merge pull request #435 from flexibeast/issue-317

Fix for issue #317.