Added fix for issue 4. Also added some unit tests for Buffer.