Fix streams order. Improve error handling.