Fix to db insertion