Fixing segfault when clicking on "new" several times