Fix a null pointer crash