fix corrupt database and some update