Fix api error and update schema