Pkg build script fixes