swap ref with atom