finished the error handling