Log bugfixes and improvements