Fix test cases to exercise all branches