Fix for issue #940