some bug fixes and can now run multiple times with multi_run.py