fix issue with pinned piece detection