Some changes to run on python3