fixing some bugs with autoplay