tweaked image fetching script