fixes for 2.6 and pypy