fix and add more test cases