fixed recursive call in main