Fixed dependencie bug and end of stream bug