Fixed overflow in `threshold` calculation