Fixed a couple of bugs with how attribute constrints are checked, added
a more complicated test case