Fixed some bugs in autoplaying