fix way databags are written

Change-Id: I79fe482f435c17936d4d614dcc73c9a82b600d70