use safe_monkeypatch and fix 3.2