Rearrange size calc to prevent div by zero exception. New calculation works as expected because calculated size can't come out as less than one.