made imbueHtml task more resilient