Fix null reference error.