fix an error when both type and message is nil, format_message returns a hash instead of string.