Logging patch

**NOTE**: As it is, this patch is required to make later later fixes work.