Fix cacheName not being correctly set sometimes, closes #429.

This was causing issues in the list command and install/update --save flag.