Fix null pointer exception and remove some logs