some bugs edited