file write for shares and minor fixup