Added fix to cancellations of requestAnimFrame.