avoid null pointers

-move call methods inside of if statement to avoid hitting cancel and
getting null pointer