use global importable function and slot to workaround pickle limitations