fix detection of existing headers