gets correct x coordinate