Fix some bugs and Add testcase