fixed log writing