Fixes issue #666