Fixes issue #1786