fix divide by zero issue