Fix bug about autoplaying and loop