Replace native 'which' with Ruby implementation.