fixed implementation of using work directories;