Fix null checks