fixing access to database