checking for headers before trying to set on them