Constraints modifs

I'm digging through the code these days, I hope you don't mind the PRs...

Here's a trivial bug fix and some modifs which I believe improve the code.

I was lazy, these could have been independent PRs, let me know if you want that.