fix critical bug that made page blinking then crash
fix a memory leak