Bug fix, plus a minor optimization to reference platform
Bug fix