Set max name length *before* calling code that uses it.