IE8 / IE9: Fixed a null pointer exception when replacing img-elements when parent is not available (e.g. by using ajax to replace content)