fix bug in endpoint