Fixed a negative shelf counter bug.