Fixed a bug that caused the :connected event to occur multiple times.