fixed error in advancePhase()