fixed requestAnimationFrame method