Correct, just only (array) $data; wasn't enough
Had to do
			$data = (array) $data;
			$data[$name] = (array) $data[$name];