Temp fix for memory leak, need to work more on this