headers not defined sometimes