Minn. moves mentally ill patients to avoid legal action