fix main func