fix db access