fix issue with empty database.