making the script compatible with python3