Improve phi(x, a) test