fixed logical error in size calculation