Fixed stat() error where cwd() wasn't being used.