add code to fix bug for main