fixed the header printing logic in man