fixed crash when upgrading from old database