Python 3 build fixes