clean-up error handling