improve on the error routing