correct _no_missing_states function and add tests for it