fix bugs, more test cases (failing)