Fix a null pointer exception when validating metadata