Fixed many things in the build system