fixing endpoints to return json