add md5checks to detect corrupt files, fix bugs