Fix main function