major AI bug fix