use is_writable() before trying to write to file/dir