Python 3 fixes from Mario Pozzo