bug in getAllPieces: current is undefined