Speedup and some minor bug fixes during pkg fetch