Initialize working directory before initializing CacheManager so that

CacheMangager will use proper cache directory

This pull request fixes issue #241.