implement repairing (#6)