fixed issues with loop mode