Array-length-checks, major bugfix in pathfind, more/extended debug-outputs, still a bug in res