Fix the bug in JoinIndex (un-comment code)