update the generate_database to make it works