Fixed error message handler