tooltip code more resilient