fixed buffering bug described in issue #44