update to trying to solve memory leak problem