before remove ref