function _initialize()
    {
        if ($this->_using_tmpfile == false) {
            return;
        }

        if ($this->_tmp_dir === '' && ini_get('open_basedir') === false) {
            // open_basedir restriction in effect - store data in memory
            // ToDo: Let the error actually have an effect somewhere
            $this->_using_tmpfile = false;  
            return new PEAR_Error('Temp file could not be opened since open_basedir restriction in effect - please use setTmpDir() - using memory storage instead');
        }

        // Open tmp file for storing Worksheet data
        if ($this->_tmp_dir === '') {
            $fh = tmpfile();
        } else {
            // For people with open base dir restriction
            $tmpfilename = tempnam($this->_tmp_dir, "Spreadsheet_Excel_Writer");
            $fh = @fopen($tmpfilename, "w+b");
        }

        if ($fh === false) {
            // If tmpfile() fails store data in memory
            $this->_using_tmpfile = false;
        } else {
            // Store filehandle
            $this->_filehandle = $fh;
        }
    }