Fixing bugs in package link logic