fix stream destroy
fix linking on linux