added error handling system