Fix a null pointer exception