Revert "Revert "Fix adding attribute keys and categories in packages.""

This reverts commit f7f29170a2e8d223229a0cb9e3eed03d749647c8.
Revert "Revert "Revert "Fix adding attribute keys and categories in packages."""

This reverts commit 4afe9c903c55abd0b154fbf85c83aa67e9f0e143.
Revert "Revert "Fix adding attribute keys and categories in packages.""

This reverts commit f7f29170a2e8d223229a0cb9e3eed03d749647c8.