Fixes issue #2366