Fixing nullpointer error while searching for pack name