fix fileWritten, misc