fixes to write to db methos <Tanvi>