fix bug in main