fixed issue #21 and issue #22