added check to see if users are connected before sending them messages