worked out the bugs for single endpoint queries