Fixes issue #502