Fixed small bug with loop output