Some small performance improvement for writing to disk.