fixed iterators and endless loop in video index creation