fixing issue #24

see comments to issue #24