clean up and expose errors