added error routing