fixed definition of phase init function