fix mem leak when downloading images is turned on.