I was always told to remove headgear when in the presence of the dead, (other than when pipeing) (not that they have ever complained)