fixes issue #505