Check if headers exist before trying to parse