Minor changes to allow empty queries