fixed database upgrading bug