Update to the 'which' implementation

A fix for issue #196