clean up errors and exceptions