Fixes in downsample.py for python 3