Debugged version of new pkg_xxx() functions (work in progress)
(tested against GRIF configuration)