fixed some errors in create_constraint.js in apply_constraint