Add constraints size validation solves #328

Solves #328 by checking the size of the constraints maps.