fix error in size calculation