fixing erode and rankOrder