size calculation improved