for compatibility with python 2 and 3

don't know if there is a more elegant solution for keeping compatibility
with python 2