fixing log writing