BUG: set direction wrong check for matrix/arrray type