Check that package name has packages associated with it before dereferencing the pointer. Fixes #345.