This seems very odd.  Why is there code in common that is only valid in the LMS?

And how can it be that we've gotten to this point without defining a simpler helper to use instead of pasting this line all over the place?