fixed bug in doEvents
Merge https://github.com/phazelift/range.js