corrected code w.r.t. atomic actions