fixing loop iteration dumbness