Fixed bad bug on for loop