Minor refactoring
Fix a potential NRE