added function to check whether pkg already installed