fixed several log bugs.