use range for
fix plotphi with new error checking
fix plotphi