fixes for pypy support