fix memory leak with no handlers