improve headers handling