Fixed bug with query submitted