Fixed error message handling