Fix for issue #640
Merge pull request #676 from Moeriki/master

Fix for issue #640