fix #485 end inserter with test cases