Add official test cases and make according fix