Check for existence of array elements to prevent errors with malformed HTTP headers