Fixed bug with zero delay, and corrected bugs then function connect called several times