deal with rank correctly.