fit all memory leaks, valgrid passed