Corrected null handling