Fixed bug -- calling the wrong onExit()