Fix error handling in Bot.