Validation fixes

I'd recommend viewing each commit on its own, since the diffs are clearer and explanations are in the extended commit message :-)