public function appendByRef($name, &$val, $merge = false)
    {
        if (isset($this->data[$name]) && !is_array($this->data[$name])) {
            settype($this->data[$name], 'array');
        }

        if ($merge === true && is_array($val)) {
            foreach ($val as $key => &$value) {
                $this->data[$name][$key] = &$value;
            }
        } else {
            $this->data[$name][] = &$val;
        }
    }