Corrected null pointer exception