fixed issue #20 and #21