Fix bug when removing test case keys