Fixed null point caused in the loggin