Fixed all compile bugs for the setup function