fixes issue #967
fixes issue #966