fixed prepareForDb