fixed some bugs in rest api