Fixes to allow clean conversion to python 3 if running under a python 3 install.

requires setuptools to work