Fixed validation (finally) and query issues