Fixed constraint creation code