Fixed some crashes related to getConnectedServer()
More cleanup