second fix for issue #640