fix error routing
tidy up