Eliminate memory leaks during refresh