Fix trailing slash generation for routes