completed the error handling