Fix possible division by 0 errors
Merge pull request #30 from DimStar77/master

Fix possible division by 0 errors