Better handling of NAs in `compare_state`.

This fixes an issue pointed out by Karl Millar, where NAs in `dir_state`
results would cause misreporting of results in `compare_state`. (I also fixed
a random missing symbol while I was here.)

This hasn't fixed everything, in the sense that there are still some races
left in tests. I don't know how far we can really push it.