Fix lots of bugs, add support for "validate" trigger, enable a lot of tests.