fix bug while insert into database