Fixed pipe locking behaviour in streams
Fixed possible fd overflows