Fix some issues in the build

Still have to fix get of global packages on build.