some quick changes to work with python3