Fix replace file multiple times

File will get a copy number. The file command should return the filename
with copy number but it doesnt. Use the reference node for querying
instead. This way it doesn't matter.