BUG: Avoid writing the inverse of the state file