Fix potential memory leak issue when lookup has been called multiple times