added some error checking to tooltip generation