fixed math problems in aicontroller