Fix incorrect size computation
Merge pull request #3452 from Dmitry-Me:fixIncorrectSizeComputation