fix bug on counting total orders