Fixing log writing