logging bugfix and enhancement