add NULL PTR Check
small changes