Added some better handling around loading img resouces