fixed cacheing bug in transpose function