public function open($data = null)
    {
        if (!session_start()) {
            throw new \RuntimeException('Could not open session.');
        }
        session_regenerate_id(true);
        $this->isOpen = true;

        if ($data === null) {
            if ($this->data === null) {
                $data =& $_SESSION;
            } else {
                //don't touch the data, only decrement the flash counters
                $this->flashStorage->decrement();
                return;
            }
        }

        foreach (['data', 'flash'] as $key) {
            if (!isset($data[ $key ])) {
                $data[ $key ] = [];
            }
        }

        $this->data         =& $data['data'];
        $this->flashStorage = new FlashVariableStorage($data['flash']);
        $this->flashStorage->decrement();
    }