Fixed bug in checking constraints.