fix bug in the returned size