Fix div by zero

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.

Fixes issue #2