fixed bug in Main