fixing phase calc