fix create pipe function