Improved invalid route handling.