Fix constraint application bug