fixed the issue in piece index