fixed bug in api endpoint