added buffer size check in linearize()
additional fixes
bugfix
Merge pull request #1 from denis-martin/master

Some bug fixes ;-)