             {
                 if (headerStyleName is String)
                 {
-                    headerStyleName =
-                        StyleManager.getStyleDeclaration("." + headerStyleName);
+                    chain = addStylesToProtoChain(String(headerStyleName), chain, target);
                 }
-
-                if (headerStyleName is CSSStyleDeclaration)
+                else if (headerStyleName is CSSStyleDeclaration)
+                {
                     chain = headerStyleName.addStyleToProtoChain(chain, target);
+                }
             }
 
             headerStyleName = getStyle("headerStyleName");

        {
            if (styleName is String)
            {
                styleName =
                    StyleManager.getStyleDeclaration("." + styleName);
            }

            if (styleName is CSSStyleDeclaration)
                chain = styleName.addStyleToProtoChain(chain, target);
        }

        chain = super.addStyleToProtoChain(chain, target);

            {
                if (headerStyleName is String)
                {
                    chain = addStylesToProtoChain(String(headerStyleName), chain, target);
                }
                else if (headerStyleName is CSSStyleDeclaration)
                {
                    chain = headerStyleName.addStyleToProtoChain(chain, target);
                }
            }
        }

