added error reporting