repare functions