fixed a bug and implented main.py