Fixing bug with rank calculation in the face of all the strange data