implemented merge
fixed a dead lock
implemented range for infinite stream