working version for cython