fixed a bug that causes crash on upgrading database
Merge branch 'dev' into f-droid