Added readyState check to a send.
Improved connection management.