Prevented AI from going out of bounds