Logging and fixes