Fixed finding all ungrounded variables after grounding variables from forward state