fix issue #4 and #5
add some test cases