Fix unicode errors, use safe_unicode instead of ensure_unicode