Minor changes to ensure compatibility with python 2 as well as 3