Fix rank_average function call