add atomic conditions to save