improve test cases and performance