This entire codepath is buggy for other reasons - which I should be resolving in a different PR anyway.
Btw, this change does not fix things - you are just going to face DCL issues which making getFile very expensive (and it is a common operation).