Fix use-after-freezy crashy code
The idx_aux variable usually is out-of-scope when the connection is triggered, leading to usage of the memory address after free. Moreover, the initial if-statement idx_aux == idx always evaluates to true and thus is a redundant check.