update db and fix bug