improve division by zero fix