minor cython performance tweaks