Fix errors on when opening with blank database