fix 'which' bug