Fix http://redmine.kokuaviewer.org/issues/1139 and provide better protection against NULL callbacks.