Corrected counting error in plotting code.