fix wrong size calculation