Fix state compare, handle pending.