Bug 976631 Fix fallout from bug 956657 and port code simplification r=Gijs