careful ranking bugfix + debug output