fixes issue #893
fixes issue #978