fixing bug with bogus rank