fixed database access problem