Fixes issue #791