cleanup, fix test cases