Fix non-standard 'which' usage