Fixed ai agent moving forward and backward.