fixing memory leak on homepage