fixed bugs in api endpoint