Fixed some count bugs