fix bug: missing rank (off by one error)