Fix for loop in index