Fix negative value handling and small bugs

Sorry for the lots of change on this pull-request, but it's worth applying. One of the major bug fix is the negative value handling. Others are small change.

- Fix negative value handling
- Add some argument verify code
- Add missing TypedArray.recycle() call
- etc...

Thanks, 
h6ah4i