Fixed listeners on connect, disconnect, undo