take scratchdir into account for modified or non-local documents