bugfix for rank ordering