If you used an S7 counter (S_CU), they are single instance. If you placed the counter in an FC that is called by multiple instances of the Palletizer FB, then you will likely have the problem you described. To verify, monitor the value of the counter and see if the number of counts is being overwritten or not updated at all. Also, counters need to be reset using a tag, so make sure that the reset tag is being set correctly.
For multiple instances, I would use an IEC counter, which has its own DB associated with it. That will allow you to keep the data for each instance of the counter FC separate from the other instances.