fixes memory leak