added support for specifying a working directory