Fixed resending/reconnecting bug