Fix deleted pointer access

Found this one with valgrind. It didn't fix bug 711 though.