I played a game and noticed that sometimes the wisps (Spirit) would be created in places that were not a jail. When this happened, I was free to move around the map. I could not be rescued unless I was in a jail, and once I went back to jail I couldn't escape again.
Edit: Tome crashing is because the game is trying to increase the level of a unit that doesn't have levels. You must absolutely remove the tome/prevent the effect before any other system. Hopefully you can code it so they can still get the refund though.