Fix parser and compare bug and add more test cases