Add some extra checks to (hopefully) prevent flakes.