Fix size calculation during recursive scan