Python 3.x fixes