fix structure corruption with ulist_pop()
new utility function to get segment size
optimize octet stream (again)