ensure that which commands are properly enclosed

Using which inside an if requires that the result be enclosed in "s
otherwise if the command is actually missing, the result is not the
empty string, it is just not there.