make the check for pkg is_installed more robust