improved _ensureNum and _ensureInt

http://dartbug.com/9708