revert to working pipe code