set up error handling