Fixes to() function.
Added $output_format in headers_encode.