Update which

Fixes memory leak