Fixed Loop Bug