fix for py3, tested of for pypy