add settings & solve some bugs