Added protection for out-of-bounds #rank calls