Fix to work with non-blocking pipes