Initial changes for porting to python3