Minor bugfixes and cleanup.

Fixed a bug in udebs where pathfinding between a location and itself
caused an error. Lots of cleanup in the test py files.