IMPORTANT UPDATE: Fixes major bugs, when reading file from tree function