call main function automatically