Fix issue writing migrated DB.

A logic bug stopped the DB from being written if it had been converted from an
old format.