fixed issue #4 and  issue #5