BUG: Prevent division by zero. Closes #650.

https://github.com/szpy/numpy/compare/bugfixes

Simple change to prevent division by zero. 

Thanks,
szpy