crossover detection and auto-correction