Fixed the current phase logic.