Added validation when creating reference