fix XY detection