use envir argument also for call to exists(), to avoid the somewhat tricky where argument