fixing lots of python code