Fixed bug in free loop search when indexes were from wrong array