Fix null handling