Fixes issue 1008