fixing divide by zero issue