Fix a bug where the database wasn't correctly recorded when ALL was selected.