Fixed opening of the db