Fixed several bugs with sending join and disconnect messages.