Fix null pointer exception.