add monkey patch to write file only after commit