Make sure images are loaded properly before accessing width/height