fixed issue with temp file write buffering bug