fix for memory leak