added error tracing