fix the random position example
set and unset the registeredPiece and draggingPiece