Fix problems in openDb().