fixing file resource handling