Prevent division by 0
Fixes #2