improved error handling for bots