Fix unsat issue, and optimize away unnecessary vars for unsafe atoms.