Fixed database access bug.