Fix for issue #640