Fix tests failing on Python 3