Replaced foreach by for loop. Maybe polymer adds at the end of the array a 'findIndex' function