If manage media is disabled (if the value of the pref is not true), you remove a not present Attribute "hidden". I think you shuld add it in this case.