PyPy fixes

Get the test suite completely passing on PyPy 2.2.1.