Fix bug in calculation of number of toggle states