phi handling still not correct