avoid extra copy in transpose