header function condition fixed