bytestream and dict API changed. Improved unittests.