fix to log writing