fix the bug that trapped piece counts