Reflect before Act: Proactive Error Correction in Language Models