Modified some files, fixed some bugs