Fixed several bugs. AI is up and operational.