Improve checks for COLLECTIVEACCESS_HOME.

+ -v checks whether the variable is defined.
+ -d checks whether the contents of the variable represent a valid path, which
  is also a directory.
+ Therefore -v should come before -d, especially when `set -u` is in effect.