added error-reporting