fixes unit tests for #2272 and pypy specifics