Fixed a problem that occurs if the write directory does not exist