Check the md5 before downloading to ignore incomplete files

Check md5 once before downloading if files already exist to avoid the case that installations always fails due to broken files created by interrupted wget processes (for example by C-c).