change route and add error handlin