checking if @ph is defined before calling exit