Fixed bug with api route