fixed massive memory leak