thread-safety issue: move ByteBuffer construction to synchronized block
Merge pull request #2 from heymjo/master

thread safety issue