fixed a weird regular expression bug in ensure_def_constraints