Bot Optimization and Crash prevention