issue #22: bug fixes