Corrected bug in the which function.