Avoid division by zero.

I could not find any other divisions that would result in NaN in the
current code. With this I will close #21.