added transaction safety for repair method