Make parseInt/parseFloat more robust

This matches the as3 behavior