bug fix in main