fixed start up bug in main()