rps: fixed compare function