for loop need to be fixed