fix function not found bug; return api error