Fix a null pointer exception for contained()