bug repair in issue #49 code