Resolve issue cancel in add causes null ptr exception.