Fix some buffering issues
Merge pull request #5 from ironcladlou/buffering-fixes

Fix some buffering issues