Fixed the divide by zero bug