fixing bug where the wrong phases were being checked