fix a memory leak & a serious server render bug