Fixed the task when no cwd is used

If no cwd is present, `undefined` is appended to the path which breaks the task