Tweaks for compat with Python 2.6 and Python 3.X