removed memory leak when refreshing browser