fix some bug in database