Fix bug in ranking methods.