fix a few bug about logging functions