fixed constraint checking bug