fix memory leak

fixes memory leak in #134