IE8 / IE9: Fixed a null pointer exception when replacing img-elements wh...

...en parent is not available (e.g. by using ajax to replace content)