Fixes for db interaction