Tweak edit cmd check order and temp file writing.