Fix circular and bad reference, add validation support