Optimized map correction code