Fixes for DB access