fixed algo.py a little