fix send and header flags logic