update ApiError and some fixes.