repair some bugs

repair some bugs
change the database code which is left

change the database