some optimizations to test cases