Fixed multiple issues with logging