fix db inserting issue
merge bochen's change