fixed AI problem