fixed memleak in internal.download()