modify some functions
modify functions write_check, write_base, insert_rest
change specification of insert and add new method upsert