clean up, null checking, show only errors in logging