Do you mean "txed" instead of sent? If you really mean "sent", why isn't this check inside the loop?