Correct the auto-detect language function