Fix detection of changed areas in Annotation dialog.

Previously, if the dialog was closed with changes areas, the changed
areas marker was not always reset when opening the dialog again (e.g. if
the dialog was opened in search mode).
Fix serious problem when converting to DB format 6.

With the quick/compressed format, categories would be lost on images.