tweaks to work on python 2.7