Fix a bug of updating database.