fixing autoplay with loops