Some fixes in build function for query: exclude fields private_key and class_uid from built query.