fixing code to suport python 3