error_check cleanup