Fixes major bug with request animation frame

Also applies to deferred callbacks. They could
not be canceled which could lead to CPU hogging.