Calling exit() on null issue solved