Fixing various python3 compatability errors