fix for issue #640