avoid division by size==0