Hotfix/407 fix db upgrade from 1.13

Fixes #407 @pmeulen and @relaxnow, would you take a look?