some test cases and bug fixed