const correctness fix for maybeGetLastChildInLabel