fix bug; requestAnimationFrame to loop