Fixed a divide by zero bug