Prevent from crash when measured width or height are 0.
Added support for inserting image instead of higlighting the element.