fix query inserter behaviour when category has spaces.