Fixed possible NPE, improved logging.

Signed-off-by: Martin Vitez <mvitez@cisco.com>