Replaced the serialize_headers method