added error check to break cyclic changes