Fixed Logging code