Lots of fixes to attribute and variation modules