Fixed log generating bugs.