Fixed problem with routes in Ticket query. Typo in route check looked for routes variable defined earlier. Removed redundant query with routes by providing a routes check.