Fix stackoverflow error when installing packs