Expand fix from e5de60d9fb to query variable

The fix for ruby 1.9+ needs to apply to "query", too. Not only "q".