fixed issue #3 and issue #5