Fixes issue#585