minor changes to narrow down the memory leak