added error handlers.