added rough code for memory leak check