Fix some Python2 backwards-incompatibility issues

We want pyes to still work with Python 2.7, right? :)