fix wrong md5 summ calc, some refactoring