correctly handle headers