tidy up logging
does this fix bug #418