Corrected null reference exception