fix probable bug in python code