move promote_pipe_return to core functions