joplick - thank you so much for playing the game, and for reporting these bugs!
I went back and checked the code and discovered the problem. There was a mistake in how I stored info for tiles with stairs on them, and the wraiths would become stuck there, infinitely looking for a path out. I also found another huge error with the tile swapping algorithm.
In addition, your experience of getting stuck made me add a reset button, so people can get out of deadends.
Thank you!