Chenges to fix db specific queries