IE8 / IE9: Fixed a null pointer exception

 by replacing img-elements when parent is not available (e.g. by using ajax to replace content)