Fix flakey tests