Modify DB and fixed some bugs