fix reseting document and merging data to document