[Reviewer: Rob] Issue624

Merging in order to get this fix into tomorrow's release, but I have a couple of cleanup comments we should address.
I had to un-protect this - the UTs didn't catch that because we disable access control. I think we should turn this into a static utility function, and also be much more disciplined about building for real as well as just running UTs.