bug fix in main.py. and modified a little bit also others.