resolve memory leak problem