improve debugging for loops and route errors