fixed bug in run-main