Fixed logging function.