Test cleanup and fixes