tomd: make script resilient in the face of cwd