Fix database access issue