fixed crashes while upgrading database

sorry for 3 updates in several hours, but hey, it's beta :)
Merge branch 'dev' into f-droid