bugfixes in validator and query