Fix db upgrade

see #140