Make sure space is handled properly in queries