serialize byte stream implemented