Fixes an issue with RequestAnimationFrame sometimes not being triggered. This time in the right way