Fix a crash that occurred during ui setup.