BUG: fix memory leak and double execution in dot

introduced in 1.8.0dev 914294a42a
closes gh-3384