add testcase & remove unused code
Merge pull request #369 from wenshao/master

add testcase & remove unused code