fixed issue #5 and issue #6