Type fixes to serializer and query
Added merge of queries