correctly check if x and y are defined