Fixed a critical bug in AI logic- should be working