Fixes #33 race condition in encode
Merge pull request #34 from ConatyConsulting/v7-fixes

Fixes #33 race condition in encode