This looks dangerous --- we should not silently modify state -- I would prefer copying or going for a deeper fix, e.g. applying _clean_names at the Layout object level.