fix bugs in transpose()