fixed some bugs, trim input and add kpiId for update kpi