Fixed many bot-related bugs. More fixes to come.