Python 3 Fixes

These are the only changes needed to compile under python 3 properly.