fixed the error handling fault