Fix for write log
this time I've really got it ;-)