Fixed a bug with connecting.