Fixes issue #513