enhance error handle.