Fix for issue #666