fixing garbage collection issue