Montana court upholds sentence of man who killed deputy