bug with requestAnimationFrame