cleanup
fix error reporting