Prevent DIRTY flag being set perpetually

An erroneously named global variable was being overwritten with the
value from prefs after extract(). Also, the installed version was trying
to be retrieved from prefs when they were not yet set up: go to the
database instead for this information.