take queries from the bug, fixes  #774