FIx db issues