fix build order bug, and tests that would have caught it