more fixes to atm.cpp