fix incorrect calculations of phase advance