Fix out of bounds exception in ant search