Fixing divide by zero issue