Resolve memory leak