fixed issue #7 and issue #8