Fixed null pointers encountered when trying to communicate with the servers