Fixed bugs that related requestAnimationFrame