Fixed Small Bug in Loop