logging message and null pointer fix