Also fix a bug in isrow (it was not checking the rank of the array). (cherry picked from commit ce49cd95)