debugging memory leaks when pressing switch 1 twice