backport File monkey patches