fixed incorrect size calculation